import { S } from '../../s';
import { PSEditorImpl } from '../pseditor-impl';
import { IPSTextEditor } from './ipstext-editor';
import { IPSSysValueRule } from '../../valuerule/ipssys-value-rule';

export class PSTextEditorImpl extends PSEditorImpl implements IPSTextEditor {
  get maxLength(): number {
    return this.M.maxLength;
  }

  get minLength(): number {
    return this.M.minLength != null ? this.M.minLength : 0;
  }

  protected pssysvaluerule: IPSSysValueRule;
  getPSSysValueRule(): IPSSysValueRule | null {
    return (
      this.pssysvaluerule ||
      (this.pssysvaluerule = this.fillObjectModel(
        S._1b,
        this.M.getPSSysValueRule,
        S._2f3,
      ) as IPSSysValueRule)
    );
  }

  get showMaxLength(): boolean {
    return this.M.showMaxLength != null ? this.M.showMaxLength : false;
  }
  get cls(): string {
    return 'PSTextEditorImpl';
  }
  instanceof(cls: string): boolean {
    if (cls == S._13f) return true;
    return super.instanceof(cls);
  }
}
